GetCompass
Reads the current value of the HiTechnic compass sensor
Contents
Syntax
degree = GetCompass(port)
degree = GetCompass(port, handle)
Description
degree = GetCompass(port) returns the current heading value of the HiTechnic magnetic compass sensor ranging from 0 to 360 where 0 is north and counterclockwise (90 = west etc.). The given port number specifies the connection port. The value port can be addressed by the symbolic constants SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4 analog to the labeling on the NXT Brick.
For more complex settings the functions NXT_LSRead and NXT_LSWrite can be used.
The last optional argument can be a valid NXT handle. If none is specified, the default handle will be used (call COM_SetDefaultNXT to set one).
Example
OpenCompass(SENSOR_4); degree = GetCompass(SENSOR_4); CloseSensor(SENSOR_4);
See also
OpenCompass, CalibrateCompass, CloseSensor, COM_ReadI2C
Signature
- Author: Rainer Schnitzler, Alexander Behrens (see AUTHORS)
- Date: 2008/08/01
- Copyright: 2007-2008, RWTH Aachen University